# CMSIS Build CMakeLists generated on 2024-05-14T00:29:57

cmake_minimum_required(VERSION 3.22)

# Target options

set(TARGET asd)
set(CPU Cortex-M0+)
set(PRJ_DIR "d:/Project/graduation-project/asd/MDK-ARM")
set(OUT_DIR "D:/Project/graduation-project/asd/MDK-ARM/out/asd/asd")
set(INT_DIR "D:/Project/graduation-project/asd/MDK-ARM/tmp/asd/asd")
set(FPU NO_FPU)
set(BYTE_ORDER Little-endian)
set(OPTIMIZE speed)
set(DEBUG on)
set(AS_FLAGS_GLOBAL "-masm=auto")
set(CC_FLAGS_GLOBAL "-std=c11 -fno-rtti -funsigned-char -fshort-enums -fshort-wchar -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality")
set(CXX_FLAGS_GLOBAL "-xc++ -std=c++11 -fno-rtti -funsigned-char -fshort-enums -fshort-wchar -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality")
set(LD_FLAGS_GLOBAL "--map --load_addr_map_info --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers --strict --summary_stderr --info summarysizes")
set(LD_SCRIPT "d:/Project/graduation-project/asd/MDK-ARM/asd_asd.sct")

set(DEFINES
  STM32U073xx
  _RTE_
  USE_HAL_DRIVER
)

set(INC_PATHS
  "d:/Project/graduation-project/asd/Core/Inc"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Inc"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Inc/Legacy"
  "d:/Project/graduation-project/asd/Drivers/CMSIS/Device/ST/STM32U0xx/Include"
  "d:/Project/graduation-project/asd/Drivers/CMSIS/Include"
  "d:/Project/graduation-project/asd/MDK-ARM/RTE/_asd"
  "C:/Users/Administrator/AppData/Local/arm/packs/ARM/CMSIS/5.9.0/CMSIS/Core/Include"
)

set(AS_ARM_SRC_FILES
  "d:/Project/graduation-project/asd/MDK-ARM/startup_stm32u073xx.s"
)

set(CC_SRC_FILES
  "d:/Project/graduation-project/asd/Core/Src/gpio.c"
  "d:/Project/graduation-project/asd/Core/Src/main.c"
  "d:/Project/graduation-project/asd/Core/Src/stm32u0xx_hal_msp.c"
  "d:/Project/graduation-project/asd/Core/Src/stm32u0xx_it.c"
  "d:/Project/graduation-project/asd/Core/Src/system_stm32u0xx.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_cortex.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_dma.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_dma_ex.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_exti.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_flash.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_flash_ex.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_gpio.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_pwr.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_pwr_ex.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_rcc.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_rcc_ex.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_tim.c"
  "d:/Project/graduation-project/asd/Drivers/STM32U0xx_HAL_Driver/Src/stm32u0xx_hal_tim_ex.c"
)

# Toolchain config map

set(REGISTERED_TOOLCHAIN_ROOT "e:/Cadence/SPB_Data/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.22.0/bin")
set(REGISTERED_TOOLCHAIN_VERSION "6.22.0")
set(TOOLCHAIN_VERSION_MIN "6.22.0")
include ("E:/Cadence/SPB_Data/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.3.0/etc/AC6.6.18.0.cmake")
include ("E:/Cadence/SPB_Data/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.3.0/etc/CMSIS-Build-Utils.cmake")

# Setup project

project(${TARGET} LANGUAGES AS_ARM C)

cbuild_get_running_toolchain(TOOLCHAIN_ROOT TOOLCHAIN_VERSION C)

# Global Flags

set(CMAKE_AS_ARM_FLAGS "${AS_ARM_CPU} ${AS_ARM_BYTE_ORDER} ${AS_ARM_DEFINES} ${AS_ARM_OPTIONS_FLAGS} ${AS_ARM_FLAGS} ${AS_FLAGS_GLOBAL}")
cbuild_get_system_includes(CC_SYS_INC_PATHS_LIST CC_SYS_INC_PATHS)
set(CMAKE_C_FLAGS "${CC_CPU} ${CC_BYTE_ORDER} ${CC_DEFINES} ${CC_OPTIONS_FLAGS} ${CC_FLAGS} ${CC_FLAGS_GLOBAL} ${CC_SYS_INC_PATHS}")
set(CMAKE_C_LINK_FLAGS "${LD_CPU} ${_LS}\"${LD_SCRIPT}\" ${LD_FLAGS_GLOBAL} ${LD_OPTIONS_FLAGS} ${LD_FLAGS}")

# Local Flags

foreach(SRC ${AS_ARM_SRC_FILES})
  set_source_files_properties(${SRC} PROPERTIES LANGUAGE AS_ARM)
endforeach()

# Compilation Database

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_custom_target(database COMMAND ${CMAKE_COMMAND} -E copy_if_different "${INT_DIR}/compile_commands.json" "${OUT_DIR}")

# Setup Target

add_executable(${TARGET} ${AS_ARM_SRC_FILES} ${CC_SRC_FILES})
set_target_properties(${TARGET} PROPERTIES PREFIX "" SUFFIX ".axf" OUTPUT_NAME "asd")
set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUT_DIR} LINK_DEPENDS ${LD_SCRIPT})
target_include_directories(${TARGET} PUBLIC ${INC_PATHS})
